// 去掉html字符串中的所有标签元素
export const loadImg = (url?: string) => {
  return new Promise((resolve, reject) => {
    if (!url)
      return resolve(true)
    const img = new Image()
    img.onload = () => {
      resolve(true)
    }
    img.onerror = reject
    img.src = url
  })
}
export function delHtmlTag(str?: string) {
  return str?.replace(/<[^>]+>/g, '')
}

export function openLink(hash: string) {
  setTimeout(() => {
    const link = document.createElement('a')
    link.href = hash.split('-').shift() as string
    link.click()
  }, 0)
}
